"""author: wenyao
   data: 2021/4/30
   project: devopscmdb
"""

#self 代表的是当前对象，而并非类
# class Person():
#     name = "wy"
#     def info(self):
#         print(f"i am {self.name}")
#         print(self)
#         print(self.__class__)
# p = Person()
# p.info()

#self 不必非写成self
#约定俗成都使用self
#实例方法  第一个参数就代表实例本身，所以不一定写成self
# class Person():
#     name = "wy"
#     def info(this):
#         print(f"i am {this.name}")
#         print(this)
#         print(this.__class__)
# p = Person()
# p.info()

#self 可以不写
class Person():
    name = "wy"
    def info(self):
        print(f"i am {self.name}")
        print(self)
        print(self.__class__)

    def info2():
        print("this is info2")
p = Person()
Person.info(p)
# p.info()  #==>  Person.info(p)
# p.info2() # ==> Person.info2(p)
Person.info2()